interface ICoffee
{
    cost():number;
}
class GeneraCoffee implements ICoffee
{
    cost(): number {
        return 10;
    }
}
class CoffeeExtraDecorator implements ICoffee
{
    private _basicCoffee:GeneraCoffee;
    cost(): number {
        return this._basicCoffee.cost();
    }
    constructor(baseCoffee:GeneraCoffee)
    {
        this._basicCoffee =  baseCoffee;
    }

} 
class BubbleDecorator extends CoffeeExtraDecorator
{
    private _bubblePrice :number= 3;
    cost():number
    {
      return super.cost().valueOf() + this._bubblePrice;
    }
}

class MilkDecorator extends CoffeeExtraDecorator
{
    private _milkPrice:number = 9;
    private _freshPrice:number = 1.5;

    const():number
    {
        return super.cost().valueOf() + this._milkPrice + this._freshPrice;
    }
}

export class DecoratorAction
{
    test()
    {
        const generaCoffee = new GeneraCoffee();
        const bubbleCoffee = new BubbleDecorator(generaCoffee);
        const milkCoffee = new MilkDecorator(bubbleCoffee);

        console.log('all price is ${milkCoffee.cost()}');

    }
}